package com.xiaoran.springboot3.servlet;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

//@WebFilter(urlPatterns = "/my")
@Slf4j
public class MyFilter implements Filter {
    @Override
    //初始化
    public void init(FilterConfig filterConfig) throws ServletException {
    log.error("Filter。。。初始化");
    }
    @Override
    public void destroy() {
        log.error("Filter。。。销毁");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        log.error("myFilter....开始工作");
        //放行
        chain.doFilter(request,response);
    }
}
